const wave_types = [
    {
        id: 1,
        label: '加速度',
        value: 'acc',
        unit: 'm/s²',
    },
    {
        id: 3,
        label: '速度',
        value: 'vel',
        unit: 'm/s',
    },
]

export const menus = [
    {
        label: '时频图',
        value: 1,
        list: wave_types,
        type: 'coll',
        selection: false,
        dir: true,
        table: true,
        icon: 'icon-yeqianqu-boxingpinputu-xuanzhong',
    },
    {
        label: '时域指标多趋势',
        value: 11,
        list: wave_types,
        selection: false,
        type: 'mult',
        table: true,
        dir: true,
        icon: 'icon-caisepu',
    },
    {
        label: '单测点指标',
        value: 2,
        selection: false,
        type: 'mult',
        dir: false,
        icon: 'icon-tezhengzhi',
        eig: true,
    },

    {
        label: '多测点指标',
        value: 10,
        selection: false,
        type: 'mult',
        dir: false,
        lscre: true,
        icon: 'icon-caisepu',
    },
    {
        label: '能量直方图',
        value: -1,
        list: wave_types,
        type: 'zhifang',
        selection: false,
        dir: true,
        table: true,
        icon: 'icon-zhifangtu',
    },
    {
        label: '单测点波形',
        value: 3,
        table: true,
        list: wave_types,
        selection: true,
        type: 'mult',
        dir: true,
        icon: 'icon-waveform',
    },
    {
        label: '多测点波形',
        value: 13,
        table: true,
        list: wave_types,
        selection: true,
        type: 'mult',
        dir: true,
        icon: 'icon-waveform',
    },

    {
        label: '单测点频谱',
        value: 4,
        table: true,
        list: wave_types,
        selection: true,
        type: 'mult',
        dir: true,
        icon: 'icon-qushitu',
    },
    {
        label: '多测点频谱',
        value: 14,
        table: true,
        list: wave_types,
        selection: true,
        type: 'mult',
        dir: true,
        icon: 'icon-qushitu',
    },
    {
        label: '瀑布图',
        value: 5,
        list: wave_types,
        selection: true,
        type: 'fall',
        dir: true,
        table: true,
        icon: 'icon-pubutu1',
    },
  

    {
        label: '设备模型图',
        value: 0,
        list: wave_types,
        type: 'img',
        dir: false,
        selection: false,
        icon: 'icon-a-2_shebeimoxing',
    },
]
export const menus_1 = [
    {
        label: '部件',
        value: 1,
        icon: 'icon-a-2_shebeimoxing',
    },
]
export const dirs = [
    {
        label: '垂直',
        value: 'V',
    },
    {
        label: '轴向',
        value: 'A',
    },
    {
        label: '水平',
        value: 'H',
    },
]
//二维
const textcolor = '#FFFFFF'
export const chartOptions = (type = '', titles = ['', ''], chartType = 'line') => {
    if (chartType == 'line')
        return {
            chart: {
                spacing: [20, 20, 0, 20],
                type: chartType,
                zIndex: 0,
                backgroundColor: 'none', // 背景颜色
                zoomType: 'x', // 设置允许在 x 轴和 y 轴方向上进行缩放

                events: {
                    click: null,
                    selection: null,
                },
            },
            annotations: [], // 初始化为空数组

            title: {
                text: '',
                style: {
                    color: textcolor,
                    fontSize: '14px',
                },
            },

            subtitle: {
                text: '',
            },
            lang: {
                resetZoom: '重置', // 修改重置缩放按钮文本
            },
            series: [],
            xAxis: {
                type, // X 轴类型设置为 datetime
                lineWidth: 1, // X 轴轴线宽度设置为 0，即不显示
                minorGridLineWidth: 0, // 次级网格线宽度设置为 0
                lineColor: 'transparent', // X 轴轴线颜色设置为透明
                gridLineWidth: 0.1, //  X 轴网格线
                tickWidth: 0.1, // 刻度线
                labels: {
                    style: {
                        color: textcolor, // 设置 X 轴刻度标签的颜色
                    },
                },
                dateTimeLabelFormats: {
                    millisecond: '%H:%M:%S.%L',
                    second: '%H:%M:%S',
                    minute: '%H:%M',
                    hour: '%H:%M',
                    day: '%m-%d',
                    week: '%m-%d',
                    month: '%Y-%m',
                    year: '%Y',
                },
                title: {
                    text: titles[0],
                    style: {
                        color: textcolor,
                        fontSize: '14px',
                    },
                },
            },
            yAxis: {
                title: {
                    text: titles[1], // Y 轴标题
                    style: {
                        color: textcolor,
                        fontSize: '14px',
                    },
                },
                plotBands: null,
                gridLineWidth: 0.1, // 网格线
                tickWidth: 0.1, // y轴刻度线
                labels: {
                    style: {
                        color: textcolor, // 设置 X 轴刻度标签的颜色为红色
                    },
                },
                // max: 0.05,
            },
            plotOptions: {
                line: {
                    dataLabels: {
                        enabled: false, // 开启数据标签
                    },
                    enableMouseTracking: true, // 关闭鼠标跟踪，对应的提示框、点击事件将不会触发
                },
                series: {
                    animation: false, // 取消动画效果
                    point: {
                        events: {
                            click: null,
                        },
                    },
                },
            },
            exporting: {
                enabled: true, // 启用导出按钮
            },
            credits: {
                enabled: false, // 禁用版权信息
            },
            legend: {
                enabled: false, // 不显示图例
                itemStyle: {
                    color: textcolor, // 设置图例文字颜色
                    fontWeight: 'bold', // 设置图例文字加粗
                    fontSize: '14px', // 设置图例文字大小为14像素
                },
            },
            tooltip: {
                valueSuffix: '', // 在提示框中为值添加后缀
                enabled: true,
                formatter: null,
                dateTimeLabelFormats: {
                    millisecond: '%H:%M:%S.%L',
                    second: '%H:%M:%S',
                    minute: '%H:%M',
                    hour: '%H:%M',
                    day: '%Y-%m-%d',
                    week: '%m-%d',
                    month: '%Y-%m',
                    year: '%Y',
                },
            },
        }
    else {
        return {
            chart: {
                type: 'column', // 指定图表类型为柱状图
                zIndex: 0,
                backgroundColor: 'none', // 背景颜色
                zoomType: 'x', // 设置允许在 x 轴和 y 轴方向上进行缩放
                annotations: [], // 用于存储添加的标记和标签
                events: {
                    click: null,
                    selection: null,
                },
            },
            title: {
                text: '', // 设置图表标题
                style: {
                    color: textcolor,
                    fontSize: '14px',
                    // fontWeight: 'bold'
                },
            },
            xAxis: {
                tickInterval: 10,
                categories: [], // x 轴分类（柱子的标签）
                title: {
                    style: {
                        color: textcolor,
                        fontSize: '14px',
                        // fontWeight: 'bold'
                    },
                    text: titles[0], // x 轴标题
                },

                lineColor: 'transparent', // X 轴轴线颜色设置为透明

                tickWidth: 0.1, // 刻度线
                labels: {
                    style: {
                        color: textcolor, // 设置 X 轴刻度标签的颜色
                    },
                    enabled: false, // 隐藏 x 轴刻度标签
                },
            },
            yAxis: {
                min: 0, // y 轴最小值
                title: {
                    text: titles[1], // y 轴标题
                    style: {
                        color: textcolor,
                        fontSize: '14px',
                    },
                },
                labels: {
                    overflow: 'justify',
                },
                gridLineWidth: 0.1, // 网格线
                tickWidth: 0.1, // y轴刻度线
                labels: {
                    style: {
                        color: textcolor, // 设置 X 轴刻度标签的颜色为红色
                    },
                },
            },
            legend: {
                enabled: false, // 不显示图例
                itemStyle: {
                    color: textcolor, // 设置图例文字颜色
                    fontWeight: 'bold', // 设置图例文字加粗
                    fontSize: '14px', // 设置图例文字大小为14像素
                },
            },
            tooltip: {
                valueSuffix: '', // 在提示框中为值添加后缀
                enabled: true,
                formatter: null,
            },
            addAnnotation: null,

            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0,
                    dataLabels: {
                        enabled: false, // 在柱子上显示数据标签
                        // 标签格式化器，可以自定义显示的内容
                        formatter: function () {
                            if (this.y !== 0) {
                                return this.y
                            } else {
                                return null // 返回 null 表示不显示数据标签
                            }
                        },
                    },
                },
            },
            series: [
                {
                    data: [], // 数据系列，每个数据对应一个柱子
                },
            ],
        }
    }
}

//3d瀑布图
export const fallWaveOptions = (type = '', len) => {
    return {
        tooltip: {
            formatter: (p) => {
                return `
                时间：${p.data[1]}
                <br />频率：${p.data[0]}
                <br />振幅：${p.data[2]}
                `
            },
        },
        xAxis3D: {
            name: '频率',
            nameTextStyle: {
                color: 'aqua',
            },
            type: 'value',
            axisLabel: {
                textStyle: {
                    color: '#FFFFFF',
                },
            },
            axisPointer: {
                lineStyle: {
                    color: '#fff',
                    width: 0.6,
                },
            },
            axisLine: {
                lineStyle: {
                    color: '#B2E3FF',
                    width: 0.6,
                },
            },
        },
        yAxis3D: {
            name: '',
            nameTextStyle: {
                color: 'aqua',
            },
            type: 'category',
            axisLabel: {
                textStyle: {
                    color: 'aqua',
                },
            },
            splitNumber: len,
            axisPointer: {
                show: false,
                lineStyle: {
                    color: '#fff',
                    width: 0.6,
                },
            },
            axisLine: {
                lineStyle: {
                    color: '#B2E3FF',
                    width: 0.6,
                },
            },
        },
        zAxis3D: {
            name: '振幅',
            nameTextStyle: {
                color: 'aqua',
            },
            type: 'value',
            axisLabel: {
                textStyle: {
                    color: 'aqua',
                },
            },
            axisPointer: {
                show: false,
                lineStyle: {
                    color: '#fff',
                    width: 0.6,
                },
            },
            axisLine: {
                lineStyle: {
                    color: '#B2E3FF',
                    width: 0.6,
                },
            },
        },
        grid3D: {
            boxHeight: 80,
            boxWidth: 350,
            boxDepth: 100,
            viewControl: { center: [0, -30, -15], alpha: 30, beta: 0 },
            splitLine: {
                show: true,
                lineStyle: {
                    color: '#B2E3FF',
                    width: 0.4,
                    type: 'dotted',
                },
            },
        },
        // series: [...data],
    }
}
export const lineStyle = (name = '') => {
    return {
        lineWidth: 1.5,
        marker: {
            symbol: 'circle', // 设置数据点标记样式为圆点
            radius: 2, // 设置数据点标记大小为4个像素
        },
        name,
    }
}
export const contextMenuData = {
    // 菜单名称   同一界面必须唯一
    menuName: 'coll',
    // 菜单显示的坐标位置
    axis: {
        x: null,
        y: null,
    },
    // 菜单选项
    menulists: null,
}
export const menuList = {
    trend: [
        {
            fnHandler: 'setMarkPoint',
            btnName: '标记',
            icon: 'icon-biaoji',
            click: () => {},
        },
        {
            fnHandler: 'clearPoint',
            btnName: '清除标记',
            icon: 'icon-qingchu',
            click: () => {},
        },
    ],
    eig: [
        {
            fnHandler: 'downloadData',
            btnName: '导出数据',
            icon: 'icon-daochu1',
            click: () => {},
        },
    ],
    wave: [
        {
            fnHandler: 'downloadData',
            btnName: '导出数据',
            icon: 'icon-daochu1',
            click: () => {},
        },
        {
            fnHandler: 'setSecondLine',
            btnName: '双游标',
            icon: 'icon-shuangyoubiao',
            click: () => {},
        },
        {
            fnHandler: 'clearLine',
            btnName: '清除标记',
            icon: 'icon-qingchu',
            click: () => {},
        },
        {
            fnHandler: 'downtestfile',
            btnName: '算法测试文件',
            icon: 'icon-sitemapceshiwenjian',
            click: () => {},
        },
        {
            fnHandler: 'openMark',
            btnName: '算法模型标注',
            icon: 'icon-biaoji',
            click: () => {},
        },
        {
            fnHandler: 'filtering',
            btnName: '滤波',
            icon: 'icon-daitonglvboqi',
            click: () => {},
        },
    ],
    fre: [
        {
            fnHandler: 'downloadData',
            btnName: '导出数据',
            icon: 'icon-daochu1',
            click: () => {},
        },
        {
            fnHandler: 'setFreDouCount',
            btnName: '频带数量',
            icon: 'icon-shuliang',
            click: () => {},
        },
        {
            fnHandler: 'freDoubling',
            btnName: '倍频',
            icon: 'icon-beipin',
            click: () => {},
        },

        {
            fnHandler: 'sideFre',
            btnName: '边频',
            icon: 'icon-bianpin',
            click: () => {},
        },
        {
            fnHandler: 'filtering',
            btnName: '滤波',
            icon: 'icon-daitonglvboqi',
            click: () => {},
        },
        {
            fnHandler: 'setCharFre',
            btnName: '特征频率',
            icon: 'icon-duibicopy',
            click: () => {},
        },
        {
            fnHandler: 'clearLine',
            btnName: '清除标记',
            icon: 'icon-qingchu',
            click: () => {},
        },
    ],
    erenges: [
        {
            fnHandler: 'setThr',
            btnName: '设置阈值',
            icon: 'icon-shezhiyuzhi',
        },
    ],
}
export const collList = [
    {
        title: '趋势图',
        ref: 'trend',
    },
    {
        title: '波形图',
        ref: 'wave',
    },
    {
        title: '频谱图',
        ref: 'fre',
    },
]

export const strList = [
    {
        title: '频谱图',
        ref: 'fre',
    },
    {
        title: '能量图',
        ref: 'erenges',
    },
    {
        title: '直方图',
        ref: 'hist',
    },
]
export const sthCol = [
    {
        label: '正常阈值',

        name: 'level1',
        color: 'rgba(0, 255, 0, 0.6)', // 绿色区域
    },
    {
        label: '一级阈值',

        name: 'level2',
        color: 'rgba(255, 255, 0, 0.6)', // 黄色区域
    },
    {
        label: '二级阈值',

        name: 'level3',
        color: 'rgba(255, 0, 0, 0.6)', // 红色区域
    },
]
export const sthForm = {
    level1: 0,
    level2: 0,
    level3: 0,
}
